<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet SYSTEM "entities.dtd">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" encoding="utf-8" indent="yes" omit-xml-declaration="yes"
    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>

<!--
 | HTML
 +-->
<xsl:template match="/document">
<html>
    <head>
        <title><xsl:value-of select="title"/></title>
        <xsl:apply-templates select="." mode="style"/>
    </head>
    <body>
        <h2><xsl:value-of select="title"/></h2>
        <xsl:apply-templates select="data/*"/>
    </body>
</html>
</xsl:template>

<!--
 | CSS
 +-->
<xsl:template match="/document" mode="style">
<style type="text/css"><![CDATA[
pre, code
{
    font-size:120%;
    color:#004;
}
pre
{
    padding-left:1em;
    margin-left:2em;
    border-left:3px solid #800;
}
]]></style>
</xsl:template>

<!--
 | HTML
 +-->
<xsl:template match="data/text">
<xsl:copy-of select="*|text()"/>
</xsl:template>

<!--
 | Back link
 +-->
<xsl:template match="data/back">
<p>
    <a href="/">
        <xsl:copy-of select="@href"/>
        <xsl:text>&lt;&lt; Back</xsl:text>
    </a>
</p>
</xsl:template>

<!--
 | Changelog list
 +-->
<xsl:template match="data/changelog">
<xsl:for-each select="item">
    <dl>
        <dt>
            <b>
                <span style="color:#808;">v.<xsl:value-of select="version"/></span>
                <xsl:text> </xsl:text>
                <span style="color:#a00; font-size:90%;">[<xsl:value-of select="date"/>]</span>
            </b>
        </dt>
        <xsl:for-each select="changed/item">
            <dd>
                <xsl:apply-templates select="." mode="changed"/>
                <xsl:copy-of select="*|text()"/>
            </dd>
        </xsl:for-each>
    </dl>
</xsl:for-each>
</xsl:template>

<xsl:template match="changed/item" mode="changed"><strong>? </strong></xsl:template>
<xsl:template match="changed/item[@type='new']" mode="changed"><strong>+ </strong></xsl:template>
<xsl:template match="changed/item[@type='change']" mode="changed"><strong>* </strong></xsl:template>
<xsl:template match="changed/item[@type='remove']" mode="changed"><strong>- </strong></xsl:template>

</xsl:stylesheet>
